Skip to content

Add use-package and keymap-set forms, remove cl-lib#169

Open
Esnos33 wants to merge 3 commits intoemacsorphanage:masterfrom
Esnos33:master
Open

Add use-package and keymap-set forms, remove cl-lib#169
Esnos33 wants to merge 3 commits intoemacsorphanage:masterfrom
Esnos33:master

Conversation

@Esnos33
Copy link
Copy Markdown

@Esnos33 Esnos33 commented Feb 13, 2026

Resolves #168

@Esnos33
Copy link
Copy Markdown
Author

Esnos33 commented Feb 14, 2026

@darth10 builds doesn't proceed, but on my machine all test passes. Is there something I should do to fix this?

@darth10
Copy link
Copy Markdown
Collaborator

darth10 commented Feb 15, 2026

I guess you're using a version later than Emacs 29.

Thinking about this further, I don't think we should be replacing all usages of define-key.
It's a legacy function (as mentioned in the documentation), but it's not marked as obsolete.

I'll refine this when I get some time.

Thanks again for your contribution! 🚀

Comment thread god-mode.el
Comment on lines -131 to +129
(suppress-keymap map t)
(define-key map [remap self-insert-command] 'god-mode-self-insert)
(keymap-set map "<remap> <self-insert-command>" #'god-mode-self-insert)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right - (suppress-keymap map t) is removed, which is used to override self-inserting keys.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are anyway remapping self-insert keys with god-mode-self-insert, so this line just doesn't do anything. With code below I checked if both keymaps are the same, and they are:


;; map1 is without (supress-keymap map t), and map2 is with it
(let ((map1 (let ((map (make-sparse-keymap)))
              ;; (suppress-keymap map t)
              (keymap-set map "<remap> <self-insert-command>" #'god-mode-self-insert)
              (let ((i ?\s))
                (while (< i 256)
                  (keymap-set map (single-key-description i) 'god-mode-self-insert)
                  (setq i (1+ i))))
              (when god-mode-enable-function-key-translation
                (dotimes (i 35)
                  (keymap-set map (single-key-description (god-mode-make-f-key (1+ i))) 'god-mode-self-insert)
                  (keymap-set map (single-key-description (god-mode-make-f-key (1+ i) t)) 'god-mode-self-insert)))
              (keymap-set map "DEL" nil)
              (keymap-set map "C-h k" #'god-mode-describe-key)
              map))
      (map2 (let ((map (make-sparse-keymap)))
              (suppress-keymap map t)
              (keymap-set map "<remap> <self-insert-command>" #'god-mode-self-insert)
              (let ((i ?\s))
                (while (< i 256)
                  (keymap-set map (single-key-description i) 'god-mode-self-insert)
                  (setq i (1+ i))))
              (when god-mode-enable-function-key-translation
                (dotimes (i 35)
                  (keymap-set map (single-key-description (god-mode-make-f-key (1+ i))) 'god-mode-self-insert)
                  (keymap-set map (single-key-description (god-mode-make-f-key (1+ i) t)) 'god-mode-self-insert)))
              (keymap-set map "DEL" nil)
              (keymap-set map "C-h k" #'god-mode-describe-key)
              map)))
  (equal map1 map2)) ;; -> t

And if suppress-keymap should do something, than tests doesn't coverage it

@Esnos33
Copy link
Copy Markdown
Author

Esnos33 commented Feb 20, 2026

Maybe I will split this commit into four different commits and then you can easily choose which you want to keep? Even if they are small changes, I think I made to many things at the same time, sorry about that.

@darth10
Copy link
Copy Markdown
Collaborator

darth10 commented Feb 20, 2026

Maybe I will split this commit into four different commits and then you can easily choose which you want to keep?

Yes, that would be helpful.

@Esnos33
Copy link
Copy Markdown
Author

Esnos33 commented Feb 24, 2026

@darth10 I tidied commits, but I still leave them as single pull request. Is it okay, or should I split them into 3 different pull request and close this one?

@darth10
Copy link
Copy Markdown
Collaborator

darth10 commented Feb 24, 2026

That's all good - I'll work through the commits and keep what's necessary.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Removing cl-lib and updating readme for use-package form and keymap-set

2 participants